package org.znxs.znxsframe.bizmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import org.znxs.znxsframe.constant.MQConstant;

import javax.annotation.Resource;

/**
 * 消息提供者
 */
@Component
public class BIMessageProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送消息 自动封装了交换机和routingKey
     * @param message
     */
    public void sendMessage(String message) {
        rabbitTemplate.convertAndSend(MQConstant.EXCHANGE_NAME, MQConstant.ROUTING_KEY, message);
    }

}
